package com.gxa.saas.portal.service.hhyservice.impl;

import com.gxa.saas.core.entity.vo.hhy.GoodsClassifyVO;
import com.gxa.saas.core.entity.vo.hhy.MonthVO;
import com.gxa.saas.core.entity.vo.hhy.TimeAndMoneyVO;
import com.gxa.saas.core.entity.vo.hhy.TotalGoodsAndMoneyVO;
import com.gxa.saas.portal.mapper.hhy.LookDataMapper;
import com.gxa.saas.portal.mapper.hhy.ShopUserMapper;
import com.gxa.saas.portal.service.hhyservice.LookDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class LookDataServiceImpl implements LookDataService{
    @Autowired
    private LookDataMapper lookDataMapper;
    @Autowired
    private ShopUserMapper shopUserMapper;

    @Override
    public List<MonthVO> getTotalMoney(Integer shopid) {
        List<MonthVO> list = new ArrayList<>();

        MonthVO monthVO = new MonthVO();
        monthVO.setThisMonth(this.lookDataMapper.getThisMothTotalMoney(shopid));
        monthVO.setLastMonth(this.lookDataMapper.getLastMothTotalMoney(shopid));

        list.add(monthVO);
        return list;
    }

    @Override
    public List<MonthVO> getAllOrder(Integer shopid) {
        List<MonthVO> list = new ArrayList<>();
        MonthVO monthVO = new MonthVO();

//        DateTime dateTime = new DateTime();
//        DateTime lastMonth = dateTime.minusMonths(1);

        monthVO.setThisMonth(shopUserMapper.thisMothAllOrder(shopid));
        monthVO.setLastMonth(shopUserMapper.lastMothAllOrder(shopid));
        list.add(monthVO);
        return list;
    }

    @Override
    public List<TimeAndMoneyVO> getThisMonthMoneyAndTime(Integer shopid) {
        List<TimeAndMoneyVO> list = this.lookDataMapper.getThisMonthMoneyAndTime(shopid);
        return list;
    }

    @Override
    public List<TimeAndMoneyVO> getLastMonthMoneyAndTime(Integer shopid) {
        List<TimeAndMoneyVO> list = this.lookDataMapper.getLastMonthMoneyAndTime(shopid);
        return list;
    }

    @Override
    public List<TotalGoodsAndMoneyVO> getTotalGoodsNumAndMoney(Integer shopid) {
        List<TotalGoodsAndMoneyVO> list = this.lookDataMapper.getTotalGoodsNumAndMoney(shopid);
        return list;
    }

    @Override
    public List<GoodsClassifyVO> getGoodsNum(Integer shopid) {
        List<GoodsClassifyVO> list = this.lookDataMapper.getGoodsNum(shopid);
        return list;
    }
}
